#pragma once

#include <string>

#include "FibEvent/BaseFiberClientHandler.h"

class HttpServer;
class HttpLocationConfig;
struct HttpRequest;

class IocpIoBaseInitiator;

class HttpFiberClient: public BaseFiberClientHandler
{
public:
	HttpFiberClient(HttpServer* server);
	~HttpFiberClient();

	virtual void DoWork(IocpIoBaseInitiator* io);

	

	HttpLocationConfig* ChooseLocation(const char* uri);

private:
	void Serve404(IocpIoBaseInitiator* io);
	bool ServeProxy(IocpIoBaseInitiator* io, HttpLocationConfig* location, HttpRequest* request);
	bool ServeFile( std::string &uri, IocpIoBaseInitiator* io );

private:
	HttpServer* m_server;
};